<?php

namespace app\common\model;

class Problem extends BaseModel
{
    public function answer()
    {
        return $this->hasMany(Problem::class, 'pid');
    }

    public function getLevelNameAttr($value, $data)
    {
        $items = [
            1 => '新手测验',
            2 => '中级测验',
            3 => '高级挑战'
        ];
        return $items[$data['level_type']];
    }
}
